<?php
/**
 * ===== groups
 * root = 1
 * administrator = 3
 * moderator = 4
 * editor = 5
 * ====/ groups
 */
$currentUsr = $session->read('MyApp_Users.InfoSettings.authCurrentUser');
?>

<div class="users view">
<h2><?php echo 'Потребител'; ?></h2>
	<dl><?php $i = 0; $class = ' class="altrow"';?>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php echo 'ID'; ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $user['User']['id']; ?>
			&nbsp;
		</dd>
		<?php
		if(Configure::read('MyApp_Users.Settings.accountActivation')) {
		?>
			<dt<?php if ($i % 2 == 0) echo $class;?>><?php echo 'Активиран'; ?></dt>
			<dd<?php if ($i++ % 2 == 0) echo $class;?>>
				<?php
				if($user['User']['is_active']==1) {
					echo '<span style="color: green"><strong>'.'да'.'</strong></span>';
				} else if($user['User']['is_active']==0) {
					echo '<span style="color: red"><strong>'.'не'.'</strong></span>';
				}
				?>
				&nbsp;
			</dd>
		<?php
		}
		?>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php echo 'Потребител'; ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $user['User']['username']; ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php echo 'Група'; ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $this->Html->link($user['Group']['title'], array('admin' => true, 'plugin' => null, 'controller' => 'groups', 'action' => 'view', $user['Group']['id'])); ?>
			&nbsp;
		</dd>
		<dt<?php if ($i % 2 == 0) echo $class;?>><?php echo 'Email'; ?></dt>
		<dd<?php if ($i++ % 2 == 0) echo $class;?>>
			<?php echo $user['User']['email']; ?>
			&nbsp;
		</dd>
	</dl>
</div>
<div class="actions">
	<ul>
		<li><?php echo $this->Html->link('Редактиране', array('admin' => true, 'plugin' => null, 'controller' => 'users', 'action' => 'edit', $user['User']['id'])); ?> </li>
		<li><?php echo $this->Html->link('Изтриване', array('admin' => true, 'plugin' => null, 'controller' => 'users', 'action' => 'delete', $user['User']['id']), null, sprintf('Сигурни ли сте, че искате да изтриете # %s?', $user['User']['id'])); ?> </li>
		<li><?php echo $this->Html->link('Списъкът потребители', array('admin' => true, 'plugin' => null, 'controller' => 'users', 'action' => 'index')); ?> </li>
		<li>
		<?php
		if($currentUsr["User"]["group_id"] == 1) {
			echo $this->Html->link('Добави потребител', array('admin' => true, 'plugin' => null, 'controller' => 'users', 'action' => 'add'));
		}
		?>
		</li>
	</ul>
</div>